#include "property.h"

QtTreePropertyBrowser* BaseProperty::mBrowserStatic=NULL;
QtVariantPropertyManager* BaseProperty::mManagerStatic=NULL;

SceneManagerProperty::SceneManagerProperty()
:BaseProperty()
{
	
}

SceneManagerProperty::SceneManagerProperty(std::string type)
:BaseProperty(type)
{
	_initProperty();
}

void SceneManagerProperty::_initProperty()
{
	QtVariantProperty *topItem=mManagerStatic->addProperty(QtVariantPropertyManager::groupTypeId(),
		QString::fromLocal8Bit("sceneManager-property"));

	//Ambient Color 
	QtVariantProperty *item=mManagerStatic->addProperty(QVariant::Color, QString::fromLocal8Bit("Ambient Color"));
	topItem->addSubProperty(item);

	//Shadow Type
	item=mManagerStatic->addProperty(QtVariantPropertyManager::enumTypeId(),
		QString::fromLocal8Bit("Shadow Type"));
	QStringList enumNames;
	enumNames << "stencil additive" << "stencil modulate" << "texture additive"<<"texture modulate";
	item->setAttribute(QString::fromLocal8Bit("enumNames"), enumNames);
	item->setValue(0);
	topItem->addSubProperty(item);

	mTopProperty=(QtProperty*)topItem;
}

void SceneManagerProperty::updateProperty()
{
	if(mTopProperty)
	{
		QList<QtProperty*> propers = mTopProperty->subProperties();
		QList<QtProperty*>::iterator ite=propers.begin();
		for(;ite!=propers.end();ite++)
		{
			QtProperty* pro=*ite;
			if(pro->isModified())
			{

			}
		}
	}
}

ViewPortProperty::ViewPortProperty()
:BaseProperty()
{

}

ViewPortProperty::ViewPortProperty(std::string type)
:BaseProperty(type)
{
	_initProperty();
}

void ViewPortProperty::_initProperty()
{
	QtVariantProperty *topItem=mManagerStatic->addProperty(QtVariantPropertyManager::groupTypeId(),
		QString::fromLocal8Bit("viewPort-property"));

	//BackGround Color 
	QtVariantProperty *item=mManagerStatic->addProperty(QVariant::Color, QString::fromLocal8Bit("BackGround Color"));
	topItem->addSubProperty(item);

	mTopProperty=(QtProperty*)topItem;
}

void ViewPortProperty::updateProperty()
{

}